package com.hwod;

import java.util.Scanner;

/**
 * 高矮个子排队
 */
public class Hwod1 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String[] input = in.nextLine().split(" ");

        String result = "[]";
        int[] data = new int[input.length];
        boolean isHeFa = true;
        for (int i = 0; i < input.length; i++) {
            try {
                data[i] = Integer.parseInt(input[i]);
            } catch (NumberFormatException e) {
                isHeFa = false;
                break;
            }
        }

        if (isHeFa) {
            if (data.length > 1) {
                for (int i = 0; i < data.length; i++) {
                    int curr = data[i];
                    if (i == 0) {
                        int next = data[i + 1];
                        if (curr < next) {
                            data[i] = next;
                            data[i + 1] = curr;
                        }
                    } else if (i % 2 == 0) {
                        int pre = data[i - 1];
                        if (i + 1 < data.length) {
                            int next = data[i + 1];
                            if (curr < pre && curr < next) { // 当前位置比两边都低
                                if (next > pre) { // 后面大，将后一个和当前交换
                                    data[i] = next;
                                    data[i + 1] = curr;
                                } else { // 前面大，将前一个和当前交换
                                    data[i] = pre;
                                    data[i - 1] = curr;
                                }
                            } else if (curr >= pre && curr < next) { // pre <= curr < next 的情况
                                data[i] = next;
                                data[i + 1] = curr;
                            } else if (curr < pre && curr >= next) { // pre > curr >= next 的情况
                                data[i] = pre;
                                data[i - 1] = curr;
                            }
                        } else { // 循环到最后一位，检查下是否需要和前和前一个交换
                            if (pre > curr) {
                                data[i] = pre;
                                data[i - 1] = curr;
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < data.length; i++) {
                if (i == data.length - 1) {
                    System.out.println(data[i]);
                } else {
                    System.out.print(data[i] + " ");
                }
            }
        } else { // 输入不合法
            System.out.println(result);
        }
    }

}
